home *** CD-ROM | disk | FTP | other *** search
/ A Virtual Reality Guide to Texas / CD.iso / texdata / vrxtra.cst / 00001_main movie script.ls next >
Encoding:
Text File  |  1998-06-17  |  6.8 KB  |  209 lines

  1. -- ┬⌐ 1994-1997 Apple Computer, Inc.  All rights reserved.
  2.  
  3.  
  4. -- Note:  We have tried, where possible, to indicate the bare
  5. -- minimum commands needed to display and manipulate QTVR movies. These commands
  6. -- are indicated in this color. In many cases the additional scripting provides
  7. -- error checking and clean-up, resulting in a more robust product, but from a
  8. -- learning point of view, experimenting with the basics may be helpful. Note that
  9. -- these lines are not in a condition to copy and paste, they are only pointers.
  10.  
  11. --=============================================================================
  12. -- Routines for initializing and cleaning up the Director movie.
  13. -------------------------------------------------------------------------------
  14.  
  15. --=============================================================================
  16. -- StartMovie
  17. --
  18. -- Runs at movie start time.  Initializes key globals, opens the external code
  19. -- library, registers the QuickTime VR components, and creates an instance of the
  20. -- XTVR Xtra.
  21. -------------------------------------------------------------------------------
  22. on StartMovieXtra
  23.   global gQTVRInstanceXtra, gPathName, gLastTimeRollover, gTheXtra, gOnPC,Xpath
  24.   put 0 into gQTVRInstanceXtra
  25.   put empty into gPathName
  26.   put false into gLastTimeRollover
  27.   
  28.   -- initialize a flag for handlers that need x-platform differences
  29.   if the machineType = 256 then set gOnPC = true
  30.   
  31.   -- register the Quicktime VR component
  32.   set gTheXtra = xtra "QTVRXtra"
  33.   
  34.   
  35.   QTVREnter(gTheXtra)
  36.  
  37.   
  38.   -- create an object from the QTVR XTRA
  39.   if not VOIDP(gTheXtra) then set gQTVRInstanceXtra = new(gTheXtra)
  40.  
  41.   
  42.  
  43.   -- initialize callbacks on the mac: 
  44.   if not gOnPC then
  45.     put CallBackTracer(mNew) into QTVRCallBackFactory
  46.     SetCallBack PanoMovie, QTVRCallBackFactory
  47.   end if
  48.   
  49.   -- ** fileIO code for PC projectors: uncomment the line of code 
  50.   -- ** below and include the fileIO xObject ("fileIO.dll") in the 
  51.   -- ** same directory as the director movie. See stopMovie also.
  52.   --   openXlib "fileIO.dll"
  53. end
  54.  
  55.  
  56. --=============================================================================
  57. -- StopMovie
  58. --
  59. -- Runs at movie stop time.  Closes any open pano or nav movies.  Disposes
  60. -- of the XCMD Callback Factory and closes the external code library.
  61. -------------------------------------------------------------------------------
  62. on StopMovieXtra
  63.   global gQTVRInstanceXtra, gTheXtra
  64.   
  65.   -- Close any open panoramic or object movies
  66.  
  67.   CloseMovieXtra
  68.  
  69.   
  70.   -- purge the object from memory
  71.   set gQTVRInstanceXtra = 0
  72.   
  73.   -- unregister the Quicktime VR component
  74.  
  75.   QTVRExit(gTheXtra)
  76.  
  77.   
  78.   -- ** fileIO code for PC projectors: uncomment the line of code below:
  79.   
  80.   closeXlib
  81.   
  82. end
  83.  
  84.  
  85.  
  86. --=============================================================================
  87. -- OpenMovie
  88. -- Opens a QTVR Movie. Relies on a passed filename (complete path), a sprite in the
  89. -- location desired for the movie, and an indication of wether the movie should
  90. -- be displayed right away.
  91. -------------------------------------------------------------------------------
  92. on OpenMovieXtra pFileName, pSpriteNum, tShowOnOpen
  93.   global gQTVRInstanceXtra, gPathName, gFileName
  94.   
  95.   -- The use of a single global gQTVRInstanceXtra constrains these routines 
  96.   -- to only allow one QTVR movie to be open at a time.
  97.   
  98.   -- Close any other open QTVR movie.
  99.   CloseMovieXtra
  100.   
  101.   -- Make the movie display in the rect covered by sprite pSpriteNum
  102.   set tRect = the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum & "," &┬¼
  103. the right of sprite pSpriteNum & "," & the bottom of sprite pSpriteNum
  104.   
  105.   -- open the movie
  106.   put QTVROpen(gQTVRInstanceXtra, pFileName, tRect, tShowOnOpen) into tResult
  107.   if tResult contains "error" then
  108.     -- Display the error in the message window
  109.     put tResult
  110.     -- initialize the object
  111.     -- set gQTVRInstanceXtra = 0
  112.     beep
  113.     exit
  114.   end if
  115.   
  116.   -- stash the path to the movie just in case we need to open a linked object movie later
  117.   put pFileName into gFileName
  118.   put ExtractPathNameXtra(pFileName) into gPathName
  119.   
  120.   -- if it's a pano we'll be wanting some callbacks
  121.   if QTVRGetQTVRType(gQTVRInstanceXtra) = "QTVRPanorama" then
  122.     InitPanoCallbacksXtra
  123.   end if
  124.   
  125.   --  don't think we need this... (eric 11/23)
  126.   --  if tShowOnOpen = "visible" then
  127.   --    QTVRUpdate(gQTVRInstanceXtra)
  128.   --  end if
  129.   
  130. end
  131.  
  132.  
  133. --=============================================================================
  134. -- CloseMovie
  135. --
  136. -- Disposes an open movie.  This does not remove the image from
  137. -- the screen.
  138. -------------------------------------------------------------------------------
  139. on CloseMovieXtra
  140.   global gQTVRInstanceXtra, gVR.MovieOpen
  141.   if IsQTVRMovie(gQTVRInstanceXtra) then
  142.     QTVRClose(gQTVRInstanceXtra)
  143.   end if
  144.   put FALSE into gVR.MovieOpen
  145. end
  146.  
  147.  
  148. --=============================================================================
  149. -- SetMovieView:
  150. --      pPan is the horizontal pan angle
  151. --      pTilt is the vertical pan angle
  152. --      pFOV is the zoom amount
  153. --      pQuality is the new quality
  154. --
  155. -- Sets the movie view to the specified pan angles.
  156. -------------------------------------------------------------------------------
  157. on SetMovieViewXtra pPan, pTilt, pFOV, pQuality
  158.   global gQTVRInstanceXtra
  159.   
  160.   
  161.   if IsQTVRMovie(gQTVRInstanceXtra) then
  162.     
  163.     -- in QTVR 1.0 objects can't zoom:
  164.     if QTVRGetQTVRType(gQTVRInstanceXtra) = "QTVRPanorama" then QTVRSetFOV(gQTVRInstanceXtra,pFOV)
  165.     
  166.     QTVRSetTiltAngle(gQTVRInstanceXtra,pTilt)
  167.     QTVRSetPanAngle(gQTVRInstanceXtra,pPan)
  168.     if not voidP(pQuality) then QTVRSetQuality(gQTVRInstanceXtra, pQuality)
  169.     QTVRUpdate(gQTVRInstanceXtra)
  170.   end if
  171. end
  172.  
  173.  
  174.  
  175. --=============================================================================
  176. -- Utility routines
  177. -------------------------------------------------------------------------------
  178.  
  179.  
  180. --=============================================================================
  181. -- ExtractPathName
  182. --      pFileName is the full file path of the file
  183. -- Returns the path component of pFileName
  184. --
  185. -- Extracts and returns the path component of a file specifier.
  186. -------------------------------------------------------------------------------
  187. on ExtractPathNameXtra pPathName
  188.   put ":" into tDelimiter
  189.   if pPathName contains tDelimiter then
  190.     put length(pPathName) into tCharPos
  191.     repeat while tCharPos >= 1
  192.       if char tCharPos of pPathName = tDelimiter then return char 1 to tCharPos - 1 of pPathName
  193.       put tCharPos - 1 into tCharPos
  194.     end repeat
  195.     return empty
  196.   else
  197.     return empty
  198.   end if
  199. end
  200.  
  201.  
  202. on resetCallbackCheckboxesXtra
  203.   set the hilite of member "MouseOverHandler Check" = false
  204.   set the hilite of member "RolloverHotSpotHandler Check" = false
  205.   set the hilite of member "MouseDownHandler Check" = false
  206.   set the hilite of member "PanZoomStartHandler Check" = false
  207.   set the hilite of member "MouseStillDownHandler Check" = false
  208.   set the hilite of member "NodeLeaveHandler Check" = false
  209. end